<template>
  <div class="px-5">
    <div class="empty-wrap" v-if="!attachList.length">暂无附件（推荐函）</div>
    <attach-list v-else :attath-data="viewList" :show-label="false"></attach-list>
  </div>
</template>

<script>
import AttachList from '@/bank/components/attach/List'
import { arrayFromString } from '@vimi/utils-tool'
import { attachAdapter } from '@/bank/components/attach/index'
export default {
  components: {
    AttachList,
  },
  props: {
    attachData: String,
  },
  data() {
    return {
      loading: false,
      dir: '',
      attachList: [],
      viewList: [],
    }
  },
  computed: {},
  watch: {
    attachData: {
      handler: function () {
        this.initData(this.attachData)
      },
      immediate: true,
    },
  },
  created() {},
  mounted() {},
  methods: {
    initData(val) {
      this.attachList = []
      this.attachList = arrayFromString(val).map(it => attachAdapter({ attachment: it }))
      this.viewList = [
        {
          tag: '',
          attachs: this.attachList,
        },
      ]
    },
  },
}
</script>

<style lang="scss" scoped></style>
